<extend name="layout/edit" />

<block name="HEADER">

</block>

<block name="CONTENT">
    <control:form id="form"/>
</block>

<block name="FOOTER">
   <script type="text/javascript">
    var  page=(function(ns){
    	
		ns.init = function(){
			if(__mode != 1){
				form.setReadonly('password',false);
				$("input[name='password']").parents('.table-cell').remove();
			}
		}
		
    	//关闭
    	ns.close = function(){
    		form.close();
    	}
    	
        //保存
        ns.save=function(){
        	var data = form.getData();
        	if(!data) return false;
        	$.ajaxs('/admin/v1/Spread/saveFrontValidity',data ,function(res){
        		var data =  res.data;
				if(data && __mode == 1){
					form.$request = {  mode:2, oid:data['id'] }
					form.setValue('is_del',0);
					form.setValue('username',data.username);
					form.setValue('nickname',data.nickname);
					form.setValue('region',data.region);
					form.setValue('province',data.province);
					form.setValue('city',data.city);
					form.setValue('identity',$.uniques(String(data.identity).split(',').concat(['1'])).join(',') );
				}
	    		form.save(1).then(function(res){
	            	form.opener.grid.load();
	            });
	    	});
        }
        
        return ns;
    }({}));
    
    $(function(){ page.init(); });
   </script>
</block>



